package com.xbongbong.admin.model.impl;

import com.xbongbong.admin.domain.dao.MirrorWorkOrderTemplateDao;
import com.xbongbong.admin.domain.entity.MirrorWorkOrderTemplateEntity;
import com.xbongbong.admin.model.MirrorWorkOrderTemplateModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @auther: xingxing.xiao
 * @date: 3/4/2020 21:13
 */
@Service("mirrorWorkOrderTemplateModel")
public class MirrorWorkOrderTemplateModelImpl implements MirrorWorkOrderTemplateModel {

    @Resource
    private MirrorWorkOrderTemplateDao mirrorWorkOrderTemplateDao;

    @Override
    public Integer insert(MirrorWorkOrderTemplateEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return mirrorWorkOrderTemplateDao.insert(entity);
    }

    @Override
    public Integer update(MirrorWorkOrderTemplateEntity entity) throws XbbException {
        long now = DateUtil.getInt();
        entity.setUpdateTime(now);
        return mirrorWorkOrderTemplateDao.update(entity);
    }

    @Override
    public List<MirrorWorkOrderTemplateEntity> findEntitys(Map<String, Object> param) {
        return mirrorWorkOrderTemplateDao.findEntitys(param);
    }

    @Override
    public List<MirrorWorkOrderTemplateEntity> insertBatch(List<MirrorWorkOrderTemplateEntity> list) {
        mirrorWorkOrderTemplateDao.insertBatch(list);
        return list;
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return mirrorWorkOrderTemplateDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
}
